package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.SignalMachineAlarmService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Description: 信号机报警统计
 * @Author: WYX.
 * @Date: 2018/5/3 14:44.
 */
@Controller
@RequestMapping("/rds_signalMachineAlarm")
public class SignalMachineAlarmController {

    @Resource
    private SignalMachineAlarmService signalMachineAlarmService;

    @ResponseBody
    @RequestMapping("getMonthCount")
    public JsonMsgDto getMonthCount(String alarmPushType, String startTime, String endTime, String orgIds, String deviceId) {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(signalMachineAlarmService.getMonthCount(alarmPushType, startTime, endTime, orgIds, deviceId));
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @ResponseBody
    @RequestMapping("showAlarmHistory")
    public DTResponseDto showAlarmHistory(DTRequestDto dtRequestDto, String deviceId, Integer deviceType, String orgIds, String time) {
        DTResponseDto dtResponseDto = null;
        try {
            dtResponseDto = signalMachineAlarmService.showAlarmHistory(dtRequestDto, deviceId, deviceType, orgIds, time);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

}
